/*
	The MIT License

	Copyright (c) 2008 IFMO/GameDev Studio

	Permission is hereby granted, free of charge, to any person obtaining a copy
	of this software and associated documentation files (the "Software"), to deal
	in the Software without restriction, including without limitation the rights
	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
	copies of the Software, and to permit persons to whom the Software is
	furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in
	all copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
	THE SOFTWARE.
*/
//	core.h


#pragma once



/*-----------------------------------------------------------------------------
	Common stuff :
-----------------------------------------------------------------------------*/

class	ECore : public ICore
	{
	public:
							ECore		( void );
							~ECore	( void );
		
		//	Feed back functions :
		virtual void		KeyDown				( uint code );
		virtual void		KeyPress			( uint code );
		virtual void		MouseMove			( int x, int y );
		virtual void		UpdateLoadingScreen	( uint load_object_num );
		
		virtual void		AddDebugString		( const char *str );
		
		virtual float		GetDeltaTime		( void );
		virtual const char	*Version			( void );
		virtual void		CacheSound			( const char *path ) {};
		virtual void		CacheImage			( const char *path ) {};

		void				Frame		( void );

	private:
		void	UpdateTimer				( void );
	
		void	ShowDebugStrings		( void );
		vector<string> dbg_strings;

		//	console stuff :
		void	ProcessShellCommands	( void );
		vector<string>	latest_command;
		int				latest_command_top;

		static void		Quit_f			( ECore *self, int argc, char **argv );
		static void		InfoTiming_f	( ECore *self, int argc, char **argv );
		static void		Fatal_f			( ECore *self, int argc, char **argv );
		
		static void		ProfDump_f		( ECore *self, int argc, char **argv );
		static void		ProfReset_f		( ECore *self, int argc, char **argv );
		
		void			UpdateLoadingScreen	( float percentage, const char *file );

		//	general timing stuff :
		uint	old_time, time, dtime, frame;

		//	game API stuff :	
		string			cfg_name;
		
		IConsole		*con;
		ISystem			*sys;
		IFileSystem		*fs;
		IShell			*shell;	
		ISoundSystem	*ss;
		INetworkSystem	*ns;	
		
		IRenderSystem	*rs;
		IInputSystem	*is;
		
		IUserInterface	*ui;
		IEditor			*ed;
		IGame			*game;
		
		IVar	*core_show_fps;
		IVar	*core_min_dtime;
		IVar	*core_max_dtime;
		IVar	*core_time_scale;
		
		ap_t	ap;
		gs_t	gs;
		gs2_t	gs2;
		gi_t	gi;
		
	};	

	
	
	
	
	
	
	
	
	